/**
 * Created with JetBrains WebStorm.
 * User: 可乐加糖
 * Date: 13-6-20
 * Time: 下午2:59
 * To change this template use File | Settings | File Templates.
 */

//定义Object的扩展方法
if(typeof Object.create !== "function"){
    Object.create = function(o){
        //定义一个对象用于返回
        function F(){}
        F.prototype = o;
        return new F();
    }
}

var Model = {
    inherited:function(){},
    created:function(){},
    prototype:{
        init:function(){}
    },
    create:function(){
        var object = Object.create(this);
        object.parent = this;
        object.prototype = object.fn = Object.create(this.prototype);
        object.created();
        this.inherited(object);
        return object;
    },
    init:function(){
        var instance = Object.create(this.prototype);
        instance.parent = this;
        instance.init.apply(instance,arguments);
        return instance;
    },
    extend:function(o){
        var extended = o.extended;
        jQuery.extend(this,o);
        if(extended)
            extended(this);
    },
    include:function(o){
        var include = o.included;
        jQuery.extend(this.prototype,o);
        if(included)
            included(this);
    }
}